//
//  HttpManagerCenter+User.m
//  HiMaster3
//
//  Created by jinghao on 16/4/18.
//  Copyright © 2016年 jinghao. All rights reserved.
//

#import "HttpManagerCenter+User.h"

@implementation HttpManagerCenter (User)

// Patoo

/**
 获取女性用户状态数据
 
 @param resultClass 返回数据解析类
 @return
 */
- (RACSignal *)getStatusWoman:(Class)resultClass {
    NSMutableDictionary *parmas = [NSMutableDictionary new];
    return [self doRacPost:@"c=istate&a=get_status_woman" parameters:parmas resultClass:resultClass];
}

/**
 获取情欲详情爱爱次数列表
 
 @param resultClass 返回数据解析类
 @return
 */
- (RACSignal *)getLustDetailsList:(Class)resultClass {
    NSMutableDictionary *parmas = [NSMutableDictionary new];
    return [self doRacPost:@"c=istate&a=get_erotic_list" parameters:parmas resultClass:resultClass];
}

/**
 获取生理次数列表
 
 @param resultClass 返回数据解析类
 @return
 */
- (RACSignal *)getHealthDetailsList:(Class)resultClass {
    NSMutableDictionary *parmas = [NSMutableDictionary new];
    return [self doRacPost:@"c=istate&a=get_physiology_list" parameters:parmas resultClass:resultClass];
}


// 设置性别
- (RACSignal *)setSex:(NSString *)sex resultClass:(Class)resultClass {
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:sex forKey:@"sex"];
    return [self doRacPost:@"c=iuser&a=check_sex" parameters:params resultClass:resultClass];
}




//一呼帮
//查询用户中心数据
- (RACSignal*)queryUserCenterWith:(Class)resultClass
{
    NSMutableDictionary *params = [NSMutableDictionary new];
    return [self doRacPost:@"c=iuser&a=get_my_detail_info" parameters:params resultClass:resultClass];
}

//设置安全密码
- (RACSignal*)setSecurityCode:(NSString *)code resultClass:(Class)resultClass
{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:code forKey:@"security_code"];
    return [self doRacPost:@"c=iuser&a=setSecurityCode" parameters:params resultClass:resultClass];

}


//申请好友接口
- (RACSignal*)addFriend:(NSString *)mobile resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:mobile forKey:@"mobile"];
    return [self doRacPost:@"c=iuser&a=apply_friend" parameters:params resultClass:resultClass];
}

//添加紧急联系人接口
- (RACSignal*) addContact:(NSString *)name phone:(NSString * )phone friendName:(NSString *)friend_name nikeName:(NSString *)nikename resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:name forKey:@"name"];
    [params setObjectNotNull:phone forKey:@"phone"];
    [params setObjectNotNull:nikename forKey:@"relation"];
    [params setObjectNotNull:friend_name forKey:@"friend_name"];
    return [self doRacPost:@"c=iuser&a=add_contact" parameters:params resultClass:resultClass];
}
//删除紧急联系人接口
- (RACSignal*)deleteContact:(NSString *)cid resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:cid forKey:@"cid"];
    return [self doRacPost:@"c=iuser&a=delete_contact" parameters:params resultClass:resultClass];
}

//编辑紧急联系人接口
- (RACSignal*) editContact:(NSString *)name phone:(NSString * )phone friendName:(NSString *)friend_name nikeName:(NSString *)nikename byId:(NSString *)lId  resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:lId forKey:@"cid"];
    [params setObjectNotNull:name forKey:@"name"];
    [params setObjectNotNull:phone forKey:@"phone"];
    [params setObjectNotNull:nikename forKey:@"relation"];
    [params setObjectNotNull:friend_name forKey:@"friend_name"];
    return [self doRacPost:@"c=iuser&a=edit_contact" parameters:params resultClass:resultClass];
}


//获取紧急联系人列表接口
- (RACSignal*)queryContactList:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    return [self doRacPost:@"c=iuser&a=query_contact_list" parameters:params resultClass:resultClass];

}

//更新用户位置和电量信息接口
- (RACSignal*)update_baseInfoWithResultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:[UserClient sharedUserClient].openType forKey:@"type"];
    [params setObjectNotNull:[UserClient sharedUserClient].openTypeId forKey:@"id"];
    return [self doRacPost:@"c=iuser&a=update_info" parameters:params resultClass:resultClass];

}

//获取系统通知接口
- (RACSignal*)getSystemMessage:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    return [self doRacPost:@"c=iuser&a=get_inform_list" parameters:params resultClass:resultClass];
}

//获取系统通知列表接口
- (RACSignal*)getMyMessage:(NSInteger)page page_size:(NSInteger)page_size withType:(NSString *)type resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObject:type forKey:@"type"];
    [params setObjectNotNull:[NSNumber numberWithInteger:page] forKey:@"page"];
    [params setObjectNotNull:[NSNumber numberWithInteger:page_size]  forKey:@"page_size"];
    return [self doRacPost:@"c=iuser&a=get_inform_list" parameters:params resultClass:resultClass];
}


//清空系统通知接口
- (RACSignal*)clearMymessageresultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    return [self doRacPost:@"c=iuser&a=clear_inform" parameters:params resultClass:resultClass];

}

//删除系统信息接口
- (RACSignal*)deleteMessageByid:(NSString *)mid resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:mid forKey:@"id"];
    return [self doRacPost:@"c=iuser&a=delete_inform" parameters:params resultClass:resultClass];
}

//修改用户信息
- (RACSignal*)modifilrUserInfo:(NSMutableDictionary *)userInfo resultClass:(Class)resultClass
{
    return [self doRacPost:@"c=iuser&a=edit_user_info" parameters:userInfo resultClass:resultClass];
}

//修改紧急联系人信息顺序接口
- (RACSignal*)changeContractSort:(NSMutableArray *)contractSort resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:contractSort forKey:@"contact"];
    return [self doRacPost:@"c=iuser&a=change_contact_sort" parameters:params resultClass:resultClass];
}

//读取系统通知接口
- (RACSignal*)readInformById:(NSString *)messageId resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:messageId forKey:@"id"];
    return [self doRacPost:@"c=iuser&a=read_inform" parameters:params resultClass:resultClass];
}

//分享给朋友接口
- (RACSignal*)shareToFriendDataRequest:(Class)resultClass{
    return [self doRacPost:@"c=iuser&a=get_share_data" parameters:nil resultClass:resultClass];
}

- (RACSignal*)getUserMessagepage:(NSInteger)page page_size:(NSInteger)page_size resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:[NSNumber numberWithInteger:page] forKey:@"page"];
    [params setObjectNotNull:[NSNumber numberWithInteger:page_size]  forKey:@"page_size"];
    return [self doRacPost:@"c=iuser&a=get_user_list" parameters:params resultClass:resultClass];
}
@end
